package com.zz.string;

/**
 * 
 * @author 张哲
 * @email a252013135@163.com
 * @date 2024/6/13 19:06
 */
public class LCR122Solution {
    public String pathEncryption(String path) {
        return path.replace('.', ' ');
    }

    public String pathEncryption2(String path){
        char[] chars = path.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if(chars[i] == '.'){
                chars[i] = ' ';
            }
        }
        return new String(chars);
    }

    public String pathEncryption3(String path){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < path.length(); i++) {
            if(path.charAt(i) == '.'){
                sb.append(" ");
            }else{
                sb.append(path.charAt(i));
            }
        }
        return sb.toString();
    }
}
